package string.nowcoder.easy;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author bruin_du
 * @description 找出字符串中第一个只出现一个的字符
 * https://www.nowcoder.com/practice/e896d0f82f1246a3aa7b232ce38029d4?
 * tpId=37&&tqId=21282&rp=1&ru=/activity/oj&qru=/ta/huawei/question-ranking
 * @date 2022/5/20 15:12
 **/
public class FirstAppearanceInString {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()){
            String str = in.next();
            char[] arr = str.toCharArray();
            Map<Character,Boolean> map = new LinkedHashMap<>();
            for (char c : arr) {
                map.put(c,!map.containsKey(c));
            }
            boolean flag = false;
            for(Map.Entry<Character,Boolean> tmp : map.entrySet()) {
                if (tmp.getValue()) {
                    System.out.println(tmp.getKey());
                    flag = true;
                    break;
                }
            }
            if(!flag)
                System.out.println(-1);
        }
    }
}
